package com.kzj.common.util;

import java.util.HashMap;
import java.util.Map;

public class InheritableThreadLocalUtil {
    static final ThreadLocal<Map<String,Object>> inheritableThreadLocal=new InheritableThreadLocal<>();
     {
        inheritableThreadLocal.set(new HashMap<>());
    }
    static public  Object get(String key) {
        return inheritableThreadLocal.get().get(key);
    }
    static public<T> T get(String key,Class<?> T)
    {
        return (T)inheritableThreadLocal.get().get(key);
    }
    static public  void set(String key,Object value){
        inheritableThreadLocal.get().put(key,value);
    }
    static public  void removeKey(String key)
    {
        inheritableThreadLocal.get().remove(key);
    }
    static public  void remove(){
        inheritableThreadLocal.remove();
    }
}
